<script setup>
import {formatPrice} from "@/utils/format.js"
import {routerTo} from "@/utils/common.js"

</script>

<template>
	<view class="card-goods-item" @click="routerTo('/pages/shop/goods?id=')">
		<view class="pic">
			<image class="img" src="/static/images/tmp_goods.jpg" mode="aspectFill"></image>
		</view>
		<view class="info">
			<view class="title">测试商品名称测试商品名称测试商品名称测试商品名称</view>
			<view class="price">
				<view class="new">
					<view class="small">￥</view>
					<view class="text">{{formatPrice(5688)}}</view>
				</view>
				<view class="old">￥{{formatPrice(12332)}}</view>
			</view>
		</view>
	</view>
</template>

<style lang="scss" scoped>
	.card-goods-item{
		.pic{
			width: 100%;
			aspect-ratio: 1 / 1;
			.img{
				width: 100%;
				height: 100%;
				border-radius: 16rpx;
			}
		}
		.info{
			padding:16rpx 0;
			.title{
				font-size: 30rpx;
				color:#333;
				font-weight: bold;
				@include text-ellipsis(1);
			}
			.price{
				display: flex;
				gap:16rpx;
				align-items: flex-end;
				padding-top:10rpx;
				.new{
					display: flex;
					align-items: flex-end;
					font-size: 32rpx;
					font-weight: bolder;
					color:$uni-color-error;
					.small{
						font-size: 24rpx;
					}
				}
				.old{
					font-size: 20rpx;
					color:#bbb;
					text-decoration: line-through;
				}
			}
		}
		
	}
</style>